<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>学生成绩</title>
    <link rel="stylesheet" href="/css/layui.css">
</head>
<body>
<!-- 表格 -->
<table class="layui-hide" id="studentScore" lay-filter="studentScore"></table>

</body>
<script src="/layui.js" charset="utf-8"></script>
<script>
    layui.use(['table','layer','form'],function(){
        let table = layui.table;
        let layer=layui.layer;
        let form=layui.form;

        table.render({
            elem: '#studentScore'
            ,url:'/student/queryStuScore'
            ,title: '学生成绩表'
            ,totalRow: true
            ,cols: [  [
                {field:'id', title:'编号 ', width:80, fixed: 'left', unresize: true, sort: true,align:'center'}
                ,{field:'studentInfo',width:120, title: '学生姓名',align:'center', sort: true, templet:function (res) {
                        return res.studentInfo.studentName;
                    }}
                ,{field:'subjectInfo',width:80, title: '科目',align:'center',templet:function (res) {
                        return res.subjectInfo.subjectName;
                    }}
                ,{field:'classes',width:120, title: '班级',align:'center',templet:function (res) {
                        return res.classes.classesName;
                    }}
                ,{field:'teachers',width:150, title: '科目老师',align:'center',templet:function (res) {
                        return res.teachers.teachersName;
                    }}
                ,{field:'score', width:120,title: '分数',align:'center'}
                ,{field:'testTime', width:120,title: '考试时间', sort: true,align:'center'}
            ]  ]
            ,page: true
            ,response: {
                statusCode: 200 //重新规定成功的状态码为 200，table 组件默认为 0
            }
            ,parseData: function(res){ //将原始数据解析成 table 组件所规定的数据
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.count, //解析数据长度
                    "data": res.data.items //解析数据列表
                };
            }
        });
    });
</script>
</html>